<body>
	<ul id="myList">
		<li>Item 1</li>
		<li>Item 2</li>
		<li>Item 3</li>
	</ul>
</body>

<script>
	let list = document.getElementById('myList')
	let newItem = document.createElement('li')
	newItem.textContent = 'New Item'

	// 获取参考节点，假设我们要在第二个 <li> 之前插入新节点
	let secondItem = list.children[1]

	list.insertBefore(newItem, secondItem) //null插入到最后，否则插入到secondItem之前
</script>
